/**
 * VUEshop
 * ============================================================================
 * * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.vueshop.com.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: 沈小白 2020-07-22 $
 */<template> 
	<view>
		<view class="panel" v-if="order">
			<view class="order-ico">
				<image class="wh100" :src="imgUrl+'common/sbzf.png'" role="img"></image>
			</view>
			<view class="pay-way">
				订单编号 :
				<text class="co-red" v-if="order">
					{{order.master_order_sn}}
				</text>
			</view>
			<view class="pay-way">
				订单金额 :
				<text class="co-red">
					{{order.goods_price.toFixed(2)}}元
				</text>
			</view>
			<navigator @tap="lookOrder" class="detail-btn" role="navigation">查看订单</navigator>
			<view class="tips">注意 : 商城平台以及销售商不会以订单异常、系统升级为由要 求您点击任何网站链接进行退款操作。</view>
		</view>
	</view>
</template>

<script>
	import {getOrderInfo,getOrder} from "@/api/api.js";
	import config from "@/api/config";
	export default {
		data() {
			return {
				order:"",
				imgUrl:config.imgUrl,
				master_order_sn:"",//总订单号
				order_sn:"",//子订单号
			};
		},
		onLoad(options){
			console.log(options)
			// if(options.master_order_sn){
			// 	var params={
			// 		master_order_sn:options.master_order_sn
			// 	}
			// }else{
			// 	var params={
			// 		order_sn:options.order_sn
			// 	}
			// }
			var params={};
			if(options.master_order_sn){
				this.master_order_sn=options.master_order_sn
				params.master_order_sn=options.master_order_sn;
				
				this.getOrder(params)
				
			}else{
			
				this.order_sn=options.order_sn;
				params.order_sn=this.order_sn
				this.getOrder(params)
			}
			
			// this.getOrderInfo(params)
		},
		methods:{
			/*订单信息*/
			getOrderInfo(params){
				getOrderInfo(params).then(res=>{
					if(res){
						this.order=res;
					}
					console.log(res)
				})
			},
			/**/
			getOrder(params){
				getOrder(params).then(res=>{
					console.log(res)
					if(res){
						this.order=res
						this.order.order_sn=res.order_list[0].order_sn
						
						
					}
				})
			},
			/*查看订单*/
			lookOrder(){
				if (this.order.order_list[0].prom_type==6){//跳转到拼单详情
				      uni.redirectTo({
				        url: '/pages/team/team_detail/team_detail?order_id=' + this.order.order_list[0].order_id
				      });
				    }else{
				      // if (typeof this.master_order_sn != 'undefined' && this.order.order_id >0){
				      //   uni.redirectTo({
				      //     url: '/pages/user/order_detail/order_detail?order_sn=' + this.order.order_sn
				      //   });
				      // }
				      uni.redirectTo({
				        url: '/pages/user/order_detail/order_detail?order_sn=' + this.order.order_sn
				      });
				    }
			}
				
		}
	}
</script>

<style lang="scss">
	/* payment.wxss */
	.panel {
		background: #fff;
	}

	.order-ico {
		padding-top: 66rpx;
		width: 324rpx;
		height: 208rpx;
		margin: 0 auto 66rpx;
	}

	.pay-way {
		font-size: 30rpx;
		line-height: 1;
		color: #333;
		margin-left: 220rpx;
		margin-bottom: 30rpx;
	}

	.detail-btn {
		display: block;
		width: 640rpx;
		margin: 60rpx auto 0;
		line-height: 72rpx;
		border: 1px solid #f3f3f3;
		font-size: 32rpx;
		color: #333;
		text-align: center
	}

	.tips {
		padding: 50rpx 55rpx;
		font-size: 28rpx;
		color: #999;
		line-height: 48rpx;
	}
</style>
